This sample demonstrates the use of the Profile-Guided Optimization (PGO) feature of the Intel compilers. For details on the PGO feature, please refer to the compiler documentation.

Using PGO is a multistep process:

  1. Compile the application with /Qprof-gen (Windows*) or -prof-gen (Linux* and macOS*) specified. This creates an instrumented executable.
  2. Run the application using a reduced-size dataset that is representative of the actual workload. Each run will create a .dyn file with profile information.
  3. Compile the application with /Qprof-use (Windows) or -prof-use (Linux* and macOS*) specified. This will create an optimized executable.
Note: the following options are used for reporting purpose
System Requirements:

Build Instructions

For Visual Studio users:
  1. Open the solution .sln file
  2. Clean the solution (Build > Clean Solution)
  3. Select the "prof_gen" configuration from the toolbar
  4. Build the project
  5. Run the application (Ctrl-F5)
  6. Select the "prof_use" configuration.
  7. Build the project and examine the build output.
For Windows Command Line users:
  1. Open the appropriate Intel Fortran compiler command prompt and navigate to sample folder
  2. Compile: ifort /Qprof-gen src\pgo_sample.f90
  3. Run the program: pgo_sample.exe
  4. Recompile: ifort /Qprof-use /Qopt-report:1 /Qopt-report-phase:pgo src\pgo_sample.f90
For Linux*/macOS* users:
  1. Set the ifort environment: source <ifort-install-dir>/bin/compilervars.sh {ia32|intel64}
  2. Navigate to sample directory
  3. Compile: ifort -prof-gen src/pgo_sample.f90
  4. Run the program: pgo_sample.exe
  5. Recompile: ifort -prof-use -qopt-report=1 -qopt-report-phase=pgo src/pgo_sample.f90

Note:that the when the build is done with /Qprof-use or -prof-use, the compiler will comment that _ADDERMOD has no .DYN information. This is because _ADDERMOD is a null routine generated for the module and it is never called.